var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  setprice: function (e) {
    var jiayou_1 = e.detail.value.qiyou_1;
    var jiayou_2 = e.detail.value.qiyou_2;
    var jiayou_3 = e.detail.value.qiyou_3;
    var chaiyou = e.detail.value.chaiyou;
    var shopid = wx.getStorageSync('shop_id');
    if (jiayou_2 == '' || jiayou_3 == '' || chaiyou == '') {
      wx.showToast({
        title: '请将数据补充完整',
        icon: 'none',
        duration: 2000
      })
      return false;
    } else {
      var param = {
        url: 'api/shop/addOilReview',
        data: {
          price_1:jiayou_1,
          price_2:jiayou_2,
          price_3:jiayou_3,
          price_4:chaiyou,
          shop_id:shopid,
        },
        success: function (res) {
          console.log(res);
          wx.showToast({
            title: res.data.msg,
            icon: 'none',
            duration: 2000
          })
          if (res.data.code == 1) {
            setTimeout(function () {
              wx.navigateBack({
                delta: 1
              })
            }, 2000)
          }
        }
      }
      app.post(param);
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

})